<template>
	<!--申请加盟-->
	<view class="community">
		<view class="head_bg" style="position: relative;"></view>
		<view class="big_box" style="top: -190rpx;">
			<view class="guide_box">
				<view class="join_li">
					<text class="join_li_text">姓名</text>
					<input class="join_li_input" type="text"  @input="get1" value="" placeholder="请输入姓名" />
				</view>	
				<view class="join_li">
					<text class="join_li_text">手机</text>
					<input class="join_li_input" type="text" @input="get2" value="" maxlength="11" placeholder="请输入手机" />
				</view>	
				<view class="join_li">
					<text class="join_li_text">城市</text>
					<input class="join_li_input" type="text" @input="get3" value="" placeholder="请输入城市" />
				</view>
				<view class="join_li">
					<text class="join_li_text">详细地址</text>
					<textarea class="join_area" value="" @input="get4" placeholder="请输入详细地址" />
				</view>
				<view class="join_li">
					<text class="join_li_text">加盟类型</text>
					<radio-group class="join_li_radio" @change="radioChange">
						<radio value="0" class="form_radio" checked="true" /><text class="join_text">个人</text>
						<radio value="1" class="form_radio"/><text class="join_text">公司</text>
					</radio-group>
				</view>
			</view>
			<view class="foot">
			   <button type="button" class="cu-btn block bg-blue lg" @tap="toAdd()">申请加盟</button>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				index: 1,
				phone:'',
				full_name:'',// 	字符串	姓名	是
				city:'',//	字符串	城市	是
				address:'',//	字符串	地址	是
				join_type:0,//	整型	加盟类型 0 个人 1公司	是

			}
		},
		methods: {
			radioChange(e){
				this. join_type = e.detail.value
			},
			get1(e){
			  this.full_name = e.detail.value;
			},
			get2(e){
			  this.phone= e.detail.value;
			},
			get3(e){
			  this.city = e.detail.value;
			},
			get4(e){
			  this.address = e.detail.value;
			},
			toAdd(){
				uni.showToast({
					icon: 'none',
				    title: '以上内容均为必填'+this.join_type
				});
				return
				let that=this;
					
				if(this.full_name && this.city && this.address){
				 
				
				that.http.tokenreq({
					url: 'user/v1/addjoin',
					data: {
				    "full_name":this.full_name,
					"city":this.city,
					"address":this.address,
					"join_type":this.join_type,
					}
				}).then((res) => {
					let e=res.data;
					if(e.code==0 && e.success){
					    uni.showModal({
					    	content:"已申请成功请等待鱼升来电",
					    	showCancel:false,
					    	success: function (res) {
					    		if (res.confirm) {
					    			uni.redirectTo({
					    				url:'/pages/user/my/my'
					    			});
					    		}
					    	}
					    });
					}
				})
				
				}else{
					uni.showToast({
						icon: 'none',
					    title: '以上内容均为必填'
					});
					return;
				}
			}
				
		}
	}
</script>
<style>
	.foot{
		position: fixed;
		left: 0;
		bottom: 0;
		width:100%;
	}
</style>
